<%@page import="Test.Question"%>
<%@page import="java.util.Iterator"%>
<%@page import="DBModule.TestPaperManager"%>
<%@page import="Test.Course"%>
<%@page import="java.util.Collection"%>
<%@page import="Servlet.Alert"%>
<%@ page import="User.User" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>选择试题批阅</title>
<link rel="stylesheet" href="css/default.css" type="text/css" />
</head>
<body>
<center>
<%
	User teacher = (User)session.getAttribute("user");
	if (teacher == null || teacher.getType() != User.TEACHER){
		Alert.setAlertMsg(request, "用户未登陆，或不是教师");
		response.sendRedirect("alert.jsp");
		return;
	}
%>
	<h2>欢迎登陆，<%=teacher.getName() %>老师，您的ID为<%=teacher.getID() %></h2>
	<br/>请选择科目批阅：
<form action="selectpaper2correct.jsp">
	<select name="course">
<%
	try{
		Collection<Course> courses = TestPaperManager.getAllCourses(teacher);
		Iterator<Course> iter = courses.iterator();
		while (iter.hasNext()){
			Course course = iter.next();
%>
		<option value="<%=course.getId() %>"><%=course.getName()%></option>
<%
		}
%>
	</select>
	<input type="submit" value="批阅">
</form>
<br/>请选择题型出题
<form action="setquestion.jsp">
	<select name="questionType">
<%
		Iterator<Integer> iter2 = Question.factory.getAllType().iterator();
		while (iter2.hasNext()){
			int type = iter2.next();
%>
		<option value="<%=type%>"><%=Question.factory.getName(type)%></option>
<%
		}
%>
	</select>
	<input type="submit" value="出题">
</form>
<%		
	}
	catch (Exception e){
		Alert.setAlertMsg(request, e.getMessage());
		response.sendRedirect("alert.jsp");
		return;
	}
%>
</center>
</body>
</html>













